<template>
  <div ref="iframeContainer" style="height:100vh;">
    <iframe ref="iframeRef" style="width:100%; height:100%; border:none;"></iframe>
  </div>
</template>

<script lang="ts" setup>
import { onMounted, ref } from 'vue'
import type { FileItem } from '@/apis'

interface Props {
  data: FileItem
}
// eslint-disable-next-line unused-imports/no-unused-vars
const props = withDefaults(defineProps<Props>(), {})

// onMounted(() => {
//   new Player({
//     id: 'videoId',
//     url: props.data?.src ?? '',
//     lang: 'zh-cn',
//     autoplay: true,
//     closeVideoClick: true,
//     videoInit: true
//   })
// })
const iframeContainer = ref(null)
const iframeRef = ref(null)

const loadExternalWebsite = () => {
  const externalUrl = 'http://localhost:8101/7.5.1-23/web-apps/apps/documenteditor/main/index.html'
  const iframe = iframeRef.value
  if (iframe) {
    iframe.src = externalUrl
  } else {
    console.error("iframe element is null");
  }
}

onMounted(() => {
  loadExternalWebsite()
})
</script>

<style lang="scss" scoped></style>
